home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- ttengine.library/background
- ttengine.library/font_database
- ttengine.library/TT_CloseFont
- ttengine.library/TT_DoneRastPort
- ttengine.library/TT_FreePixmap
- ttengine.library/TT_GetAttrsA
- ttengine.library/TT_GetPixmapA
- ttengine.library/TT_OpenFontA
- ttengine.library/TT_SetAttrsA
- ttengine.library/TT_SetFont
- ttengine.library/TT_Text
- ttengine.library/TT_TextExtent
- ttengine.library/TT_TextFit
- ttengine.library/TT_TextLength
- ttengine.library/background ttengine.library/background
-
-
- PURPOSE
-
- The library is fast, AmigaOS friendly TrueType render engine. It has
- nothing to do with Amiga outline font system. This system has a lot of
- limitations which make it useless for high speed and quality text output.
- If someone wants an integration of TrueType with AmigaOS bullet.library
- like outline font system, should consider using ttf.library. This library
- opens TrueType font by itself and renders high quality glyphs directly
- into any RastPort.
-
- FREETYPE2 BASED
-
- The render engine of the library is based on FreeType2 project
- (http://www.freetype.org). This version of ttengine.library uses 2.0.9
- FreeType build.
-
- REQUIREMENTS
-
- - OS 3.0+.
- - 68020 or better processor.
- - for antialiased output graphics board with at least 15-bit screenmode
- and RTG system: CyberGraphX 3.x+ or Picasso96 2.x+.
-
- FEATURES
-
- The library expands FreeType functionality making usage of TrueType fonts
- easy and comfortable. Below you can find key features:
-
- - renders whole strings (not single glyphs) with kerning.
- - antialiasing to any (not neccesarily uniform color) background.
- - system compatible output to any (including planar) RastPort.
- - supports JAM1. JAM2, INVERSVID, COMPLEMENT RastPort modes.
- - supports 8-bit to Unicode mapping with "ENV:ttfcodepage" table
- compatible with ttf.library.
- - allows for direct 16-bit Unicode string rendering.
- - easy to use, taglist based API almost identical to graphics.library
- font API.
- - efficient system-wide glyph cache system.
-
- CACHE SYSTEM
-
- The library uses my own (not that experimental FreeType one) cache system
- speeding up strings rendering alot. The cache is system-wide, it means it
- is common to every application using ttengine.library. Only used glyphs of
- given font face are cached. If the library encounters cache miss, missing
- glyph is loaded and rasterized on the fly. Cache system is totally
- transparent to the library user, so there are no cache functions in the
- library API. Cache uses one single Exec memory pool avoiding memory
- fragmentation.
-
- ttengine.library/font_database ttengine.library/font_database
-
- GENERAL INFORMATION
-
- 'ttengine.database' is a plain text file (placed in 'ENV:' directory)
- containing informations about TrueType fonts available in the system.
- There is no tool (yet) to automatically generate it, the database have to
- be written by hand. Every line contains one keyword followed by parameter
- value. Name and value can be separated by space(s) or equality sign,
- exactly the same as shell command parameters (to say more - database is
- parsed by the same ReadArgs() system call as shell command parameters
- are). Parameter values containing spaces should be quoted. Here are some
- examples:
-
- FAMILY Tahoma
- FAMILY=Times
- FAMILY = "Times New Roman"
- FAMILY "Weird Font"
-
- KEYWORDS
-
- FAMILY - defines the name used for font opening. All variants of the font
- (italic, bold, black, heavy, light, demi etc.) will have the same family
- name. Family names (and aliases described below) are case insensitive.
-
- ALIAS - defines another name for the same family. It generally has three
- purposes:
-
- 1. Similar names for the same font, like "Times", "TimesNewRoman" and
- "Times New Roman".
-
- 2. One replacement font for some very similar ones, for example
- "Helvetica" and "Switzerland" can be aliased to "Arial".
-
- 3. Generic names like "default", "serif", "sans-serif", "monospaced". An
- application can request generic name without specific family name, or
- generic font can be used as a fallback if given name can't be found in
- the database. For example you can alias "monospaced" to "Courier", and an
- application (be it CSS compatible HTML viewer) can request
- 'LucidaConsole, monospaced'. If there is no LucidaConsole font in the
- system, Courier will be used. The same way you can alias any font to any
- other, for example Times to Arial, this makes not much sense however.
- 'default' font can be used as a last resort.
-
- FILE - defines single TrueType font file and its attributes, which are:
- FILE itself - defines a path to the font file. Font files can be placed
- anywhere in the filesystem(s). There is no default value for the
- attribute, it must be given explicitly.
- WEIGHT - defines font weight in Cascading Style Sheets manner, where 0
- means the lightest and 999 means the heaviest weight. 400 is typical
- value for normal weight, 700 for bold. Default value is 400 (normal).
- STYLE - "regular" or "italic" for italic and oblique faces. Default
- value is "regular".
- SMOOTHSMALL - controls antialiasing of small sizes. Any sizes smaller or
- equal to SMOOTHSMALL will be antialiased. Note: can be overriden by
- application. Default value is 9.
- SMOOTHBIG - controls antialiasing of big sizes. Any sizes bigger or
- equal to SMOOTHBIG will be antialiased. Note: can be overriden by
- application. Default value is 18.
-
- Every FILE is automatically added to the nearest FAMILY defined above
- in the database file. Every ALIAS or FILE placed before the first
- FAMILY is rejected quietly.
-
- COMMENTS
-
- You can place any full-line comments in the file starting a line with
- hash or semicolon. End-line comments are not supported.
-
- ttengine.library/TT_CloseFont ttengine.library/TT_CloseFont
-
- NAME
- TT_CloseFont -- Closes TrueType font. (V4)
-
- SYNOPSIS
- TT_CloseFont (font)
- A0
-
- VOID TT_CloseFont (APTR);
-
- FUNCTION
- Closes font opened by TT_OpenFontA()
-
- INPUTS
- font - the result of TT_OpenFontA(). Can be NULL, no action is taken
- in the case.
-
- RESULT
- none
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA()
-
- ttengine.library/TT_DoneRastPort ttengine.library/TT_DoneRastPort
-
- NAME
- TT_DoneRastPort -- Releases TTEngine resources associated to a
- RastPort. (V5)
-
- SYNOPSIS
- TT_DoneRastPort (rastport)
- A1
-
- VOID TT_DoneRastPort (struct RastPort*);
-
- FUNCTION
- Frees internal TTEngine resources associated with a RastPort.
- TTEngine creates rendering environment for every RastPort at first
- call of TT_SetFont() or TT_SetAttrs() for this RastPort. You should
- free this environment before disposing RastPort (typically before
- closing a window or screen). Leaving rendering environment not freed
- has two drawbacks. Firstly it causes memory leak, this memory is
- recovered however when ttengine.library is expunged. Secondly it is
- possible that a new RastPort will be created at the same address as
- disposed one. Then TTEngine will not create new rendering context but
- use old instead, which can lead to some unexpected behaviour.
-
- INPUTS
- rastport - pointer to RastPort. Rendering environment for this
- RastPort will be disposed. Can be NULL, in the case function does
- nothing.
-
- RESULT
- none
-
- EXAMPLE
- font = TT_OpenFont( /* tags */ );
- window = OpenWindowTags(NULL, /* tags */);
- TT_SetFont(rport, font); /* environment is created here */
- TT_SetAttrs(rport, TT_Window, window, /* ... */);
-
- /* you can call TT_SetAttrs() and TT_SetFont() as many times */
- /* as you want */
-
- TT_DoneRastPort(rport); /* environment is disposed */
- CloseWindow(window); /* RastPort is disposed */
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_SetAttrsA(), TT_SetFont()
-
- ttengine.library/TT_FreePixmap ttengine.library/TT_FreePixmap
-
- NAME
- TT_FreePixmap -- Releases grayscale pixmap. (V5)
-
- SYNOPSIS
- TT_FreePixmap (pixmap)
- A0
-
- VOID TT_FreePixmap (struct TT_Pixmap*);
-
- FUNCTION
- Frees pixmap data and structure allocated by TT_GetPixmap().
-
- INPUTS
- pixmap - pointer to TT_Pixmap structure. May be NULL, function does
- nothing in the case.
-
- RESULT
- none
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_GetPixmapA()
-
- ttengine.library/TT_GetAttrsA ttengine.library/TT_GetAttrsA
-
- NAME
- TT_GetAttrsA -- Gets current font and render engine attributes (V4).
-
- SYNOPSIS
- count = TT_GetAttrsA (rastport, taglist)
- A1 A0
-
- ULONG TT_GetAttrsA (struct RastPort*, struct TagItem*);
-
- count = TT_GetAttrs (rastport, Tag1, ...)
-
- ULONG TT_GetAttrs (struct RastPort*, Tag, ...);
-
- FUNCTION
- Gets current font or render engine attributes for given RastPort. The
- value of every attribute is written to an ULONG pointed by ti_Data
- field of the TagItem. Here is a list of attributes:
-
- TT_Antialias - Current state of an antialias switch (on, off or
- auto).
-
- TT_FontAscender - This is a distance (in pixels) between the baseline
- and top elements of the font (typically these elements are accents
- of capital letters). NOTE: many shareware TT fonts have wrong ascen-
- der value.
-
- TT_FontDescender - This is a distance (in pixels) between the
- baseline and bottom elements of the font (typically in letters 'p',
- 'q', 'g' etc.). NOTE: many shareware TT fonts have wrong descender
- value. Descender value is typically negative (as bottom elements
- usually are placed below the baseline).
-
- TT_FontName - full font name as found in the font file. Pointer to a
- NULL-terminated string is written. This string is localized if the
- font file contains names in different languages. Language
- precedence is loaded from "Preferred languages" table of
- locale.library.
-
- TT_FamilyName - font family name as found in the font file. Pointer
- to a NULL-terminated string is written. This string is localized if
- the font file contains names in different languages. Language
- precedence is loaded from "Preferred languages" table of
- locale.library.
-
- TT_SubfamilyName - font subfamily name (typically describing font
- variant like "italic" or "bold") as found in the font file. Pointer
- to a NULL-terminated string is written. This string is localized if
- the font file contains names in different languages. Language
- precedence is loaded from "Preferred languages" table of
- locale.library.
-
- TT_Transparency - returns actual transparency setting.
-
- NOTE: TTFA_Ascender and TTFA_Descender are guarranted to fulfill
- following formula: ascender - descender = font height.
-
- INPUTS
- rastport - attributes associated with this RastPort will be returned.
- taglist - the list of attributes.
-
- RESULT
- counter - the count of recognized tags.
-
- NOTES
- Data returned are valid only until TT_CloseFont() call.
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), TT_SetAttrsA()
-
- ttengine.library/TT_GetPixmapA ttengine.library/TT_GetPixmapA
-
- NAME
- TT_GetPixmapA -- Renders string to 8-bit grayscale pixel map. (V5)
-
- SYNOPSIS
- pixmap = TT_GetPixmapA (font, string, count, taglist)
- A1 A2 D0 A0
-
- struct TT_Pixmap *TT_GetPixmapA (APTR, APTR, ULONG, struct TagItem*);
-
- pixmap = TT_GetPixmap (font, string, count, Tag1, ...)
-
- ULONG TT_GetPixmap (APTR, APTR, ULONG, Tag, ...);
-
- FUNCTION
- Renders a string to 8-bit grayscale pixel map. Function may be useful
- if the string image is additionally manipulated before rendering into
- RastPort (e.g. in image processing software). Pixel map is a
- continuous memory area where one byte represents one gray pixel (0 is
- black, 255 is white). The first byte is the upper left pixmap corner.
- Pixels are placed left-to-right in rows, rows are placed
- top-to-bottom. There is no row padding, it means pixmap modulo is
- always the same as pixmap width and pixmap data size is equal to width
- * height. The function accepts following tags:
-
- TT_Antialias - (BOOL) - controls antialiasing (on, off or
- automatic):
- TT_Antialias_Off - turns antialias off
- TT_Antialias_On - turns antialias on
- TT_Antialias_Auto (default) - antialias state depends on font
- size. Typically sizes of 9 or less pixels are antialiased, sizes
- from 10 to 19 pixels are not antialiased, sizes of 20 of more
- pixels are antialiased. These settings can be changed in the font
- database separately for every font face.
-
- TT_Encoding - selects font encoding table to be used:
- TT_Encoding_Default - loads encoding table from "ENV:ttfcodepage"
- file, compatible with ttf.library. If no such file is found,
- ISO-8859-1 encoding (Amiga default) is used.
- TT_Encoding_Unicode - strings are interpreted as tables of 16-bit
- Unicode characters.
- TT_Encoding_WideUnicode - strings are interpreted as tables of
- 32-bit Unicode characters.
- TT_Encoding_ISO8859_1 - ISO-8859-1 (Western Europe).
- TT_Encoding_ISO8859_2 - ISO-8859-2 (Eastern and Central Europe).
-
- TT_ScaleX - a floating point (IEEE single precision) horizontal scale
- factor. Its absolute value will be limited to <0.01, 100> range. It
- may be negative (it means horizontal mirror around starting pen
- position, string will be rendered to the left).
-
- TT_ScaleY - a floating point (IEEE single precision) vertical scale
- factor. Its absolute value will be limited to <0.01, 100> range. It
- may be negative (it means vertical mirror around the baseline,
- string will be rendered mostly under the baseline).
-
- INPUTS
- font - font pointer obtained with TT_OpenFont().
- string - pointer to string to be rendered to a pixmap.
- count - length of the string in characters (only equal to bytes in
- pure 8-bit encodings).
- taglist - list of rendering attributes.
-
- RESULT
- pixmap - structure describing a pixmap defined as follows:
-
- struct TT_Pixmap
- {
- ULONG ttp_Size;
- ULONG ttp_Width;
- ULONG ttp_Height;
- UBYTE *ttp_Data;
- };
-
- ttp_Size is the size of the structure (not the pixmap) containing
- useful informations including ttp_Size itself. For V5 pixmaps the size
- is 16 bytes. ttp_Width is pixmap width (and modulo) in bytes.
- ttp_Height is a number of pixmap rows. ttp_Data points to actual
- pixmap data.
-
- Function returns NULL if pixmap allocation fails.
-
- NOTES
- TT_Pixmap structure is READ ONLY.
-
- BUGS
-
- SEE ALSO
- TT_FreePixmap(), TT_OpenFontA(), TT_SetAtrrsA()
-
- ttengine.library/TT_OpenFontA ttengine.library/TT_OpenFontA
-
- NAME
- TT_OpenFontA -- Opens TrueType font. (V4)
-
- SYNOPSIS
- font = TT_OpenFontA (taglist)
- A0
-
- APTR TT_OpenFontA (struct TagItem*);
-
- font = TT_OpenFont (Tag1, ...)
-
- APTR TT_OpenFont (Tag, ...);
-
- FUNCTION
- Opens a TrueType font preparing it to use with any RastPort. Font may
- be specified directly as a path to "*.ttf" file, or indirectly via
- set of attributes, database search will be performed for this set and
- best matching font will be opened. It is graphics.library OpenFont()
- counterpart but taglist is used instead TextAttr structure.
-
- INPUTS
- taglist - a list of tags containing requested font attributes.
- Following tags are recognized:
- TT_FontFile - this tag is a pointer to string containing a full
- path to TrueType font file to be opened. This tag allows for
- overriding database search and match. That means
- TT_FamilyTable, TT_FontStyle and TT_FontWeight are ignored if
- TT_FontFile is specified. Useful for opening application
- specific fonts, containing for example musical notes or some
- other kind of symbols. This tag has no default value.
- TT_FamilyTable - NULL-terminated table of pointers to font family
- names from the most desired to the last resort fallback. It is
- intended for easy implementing things like HTML 'FONT FACE'
- attribute. You can use real family names here, as well as
- generic names: 'serif', 'sans-serif', 'monospaced', 'cursive',
- 'fantasy', and 'default', especially useful as a fallbacks.
- Family names are case insensitive.
- The default value for the tag is {"default", NULL};
- TT_FontSize - font size in pixels defined as the distance between
- baselines of two following text lines. The default value for
- this tag is 14 pixels.
- TT_FontStyle - there are three styles defined:
- TT_FontStyle_Regular (default),
- TT_FontStyle_Italic,
- TT_FontWeight - defined with Cascading Style Sheets manner as a
- number from 0 (the lightest face) to 999 (the heaviest face).
- You can use TT_FontWeight_Normal (equal to 400) and
- TT_FontWeight_Bold (equal to 700) shortcuts.
- TT_FontWeight_Normal is the default value.
-
- RESULT
- success - font pointer (for use with TT_SetFont() and TT_CloseFont())
- if the font has been opened successfully, NULL
- otherwise. This function can fail for four reasons:
- 1. There is no matching face in the database (NOTE: even
- 'default' can fail if not defined in the database!)
- 2. File not found or malformed.
- 3. Zero font size.
- 4. No memory for requested (too big?) size.
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_SetFont(), TT_CloseFont(), font_database
-
- ttengine.library/TT_SetAttrsA ttengine.library/TT_SetAttrsA
-
- NAME
- TT_SetAttrsA -- Sets rendering engine and font attributes. (V4)
-
- SYNOPSIS
- count = TT_SetAttrsA (rastport, taglist)
- A1 A0
-
- ULONG TT_SetAttrsA (struct RastPort*, struct TagItem*);
-
- count = TT_SetAttrs (rastport, Tag1, ...)
-
- ULONG TT_SetAttrs (struct RastPort*, Tag, ...);
-
- FUNCTION
- Sets render engine settings for given RastPort. Every following
- TrutType render and metrics calls for this RastPort will use these
- settings. Here is a list of attributes:
-
- TT_ColorMap - (struct ColorMap*) - ColorMap used to convert pen
- number to RGB color value.
-
- TT_Screen - (struct Screen*) - useful shortcut for TT_ColorMap,
- automatically sets screen ColorMap.
-
- TT_Window - (struct Window*) - useful shortcut for TT_ColorMap,
- automatically sets window ColorMap.
-
- TT_Antialias - (BOOL) - controls antialiasing (on, off or
- automatic):
- TT_Antialias_Off - turns antialias off
- TT_Antialias_On - turns antialias on
- TT_Antialias_Auto (default) - antialias state depends on font
- size. Typically sizes of 9 or less pixels are antialiased, sizes
- from 10 to 19 pixels are not antialiased, sizes of 20 of more
- pixels are antialiased. These settings can be changed in the font
- database separately for every font face.
-
- TT_Encoding - selects font encoding table to be used:
- TT_Encoding_Default - loads encoding table from "ENV:ttfcodepage"
- file, compatible with ttf.library. If no such file is found,
- ISO-8859-1 encoding (Amiga default) is used.
- TT_Encoding_Unicode - strings are interpreted as tables of 16-bit
- Unicode characters.
- TT_Encoding_ISO8859_1 - ISO-8859-1 (Western Europe).
- TT_Encoding_ISO8859_2 - ISO-8859-2 (Eastern and Central Europe).
-
- TT_Transparency - Allows for rendering transparent text (the
- background shines through the text). 0 value means no transparency
- (this is the default), 255 is maximum transparency.
-
- TT_ScaleX - a floating point (IEEE single precision) horizontal scale
- factor. Its absolute value will be limited to <0.01, 100> range. It
- may be negative (it means horizontal mirror around starting pen
- position, string will be rendered to the left).
-
- TT_ScaleY - a floating point (IEEE single precision) vertical scale
- factor. Its absolute value will be limited to <0.01, 100> range. It
- may be negative (it means vertical mirror around the baseline,
- string will be rendered mostly under the baseline).
-
- TT_SoftStyle - controls software generated font modifications. Any of
- software styles can be combined (OR-ing the values).
-
- TT_SoftStyle_None - clears all software styles.
- TT_SoftStyle_Underlined - boolean tag controlling text underline.
- TT_SoftStyle_DblUnderlined - boolean tag controlling text double
- underline. Combining it with TT_Underlined gives one thick line.
- TT_SoftStyle_Overstriked - boolean tag controlling text overstriked
- line.
- TT_SoftStyle_DblOverstriked - boolean tag controlling text
- overstriked double line. Combining it with TT_Overstriked gives
- one thick line.
-
- TT_Foreground - allows for using direct RGB value of foreground color
- instead of RastPort 'A' pen. On LUT screens this tag will be
- ignored. Special value TT_Foreground_UseRastPort returns foreground
- color control back to the RastPort and its 'A' pen.
-
- TT_Background - allows for using direct RGB value of background color
- (used in JAM2 drawmode only) instead of RastPort 'B' pen. On LUT
- screens this tag will be ignored. Special value
- TT_Background_UseRastPort returns background color control back to
- the RastPort and its 'B' pen.
-
- INPUTS
- rastport - attributes will be set for this RastPort.
- taglist - the list of attributes.
-
- RESULT
- counter - the count of recognized tags.
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), TT_Text(), TT_GetAttrs()
-
- ttengine.library/TT_SetFont ttengine.library/TT_SetFont
-
- NAME
- TT_SetFont -- Sets TrueType font for a RastPort. (V4)
-
- SYNOPSIS
- TT_SetFont (rastport, font)
- A1 A0
-
- BOOL TT_SetFont (struct RastPort*, APTR);
-
- FUNCTION
- Sets a font previously opened with TT_OpenFontA() for use with given
- RastPort. All further calls of text rendering or metrics function for
- this RastPort will use font set.
-
- INPUTS
- rastport - The font will be set for this RastPort.
- font - Pointer returned by TT_OpenFontA(). May be NULL, function
- returns immediately in the case.
-
- RESULT
- TRUE if success, false otherwise.
-
- EXAMPLE
- /* use two fonts to render in one RastPort */
-
- APTR times, arial;
-
- times = TT_OpenFont(
- TT_FamilyTable, (ULONG){"Times", "serif", "default", NULL},
- TT_FontSize, 26,
- TAG_END);
-
- arial = TT_OpenFont(
- TT_FamilyTable, (ULONG){"Arial", "sans-serif", "default", NULL},
- TT_FontSize, 22,
- TT_FontWeight, TT_FontWeight_Bold,
- TAG_END);
-
- if (times && arial)
- {
- SetAPen(win->RPort, 1);
- SetDrMd(win->RPort, JAM1);
- Move(win->RPort, 100, 100);
- TT_SetAttrs(win->RPort, TT_Window, win, TAG_END);
-
- if (TT_SetFont(win->RPort, times))
- TT_Text(win->RPort, "Times 26 points", 15);
- if (TT_SetFont(win->RPort, arial))
- TT_Text(win->RPort, "Arial 22 points", 15);
- }
- if (arial) TT_CloseFont(arial);
- if (times) TT_CloseFont(times);
-
- NOTES
- Function can fail returning FALSE if:
- 1. RastPort pointer is NULL.
- 2. Font pointer is NULL.
- 3. Font pointer is not found on opened fonts list (it means the pointer
- was not obtained as a result of TT_OpenFontA() call).
- 4. Memory allocation during environment creation fails.
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), TT_SetAttrsA(), TT_CloseFont()
-
- ttengine.library/TT_Text ttengine.library/TT_Text
-
- NAME
- TT_Text -- Renders string into RastPort. (V4)
-
- SYNOPSIS
- TT_Text (rastport, string, count)
- A1 A0 D0
-
- VOID TT_Text (struct RastPort*, APTR, ULONG);
-
- FUNCTION
- Renders the string using current ttengine.library settings, and
- current RastPort settings (pen, drawmode). String is rendered at
- current RastPort (x, y) position, where 'y' means position of font
- baseline. String is converted to Unicode according to
- current (set by TT_SetAttrs()) encoding table.
-
- INPUTS
- rastport - Target RastPort for rendering.
- string - String to render to (need not to be NULL terminated).
- count - How many characters to render (note that NULL code will
- be rendered as well).
-
- RESULT
- none
-
- EXAMPLE
- /* write a text with pen 1 and transp. background at (100, 100) */
- /* rendering is done to a system window */
-
- SetAPen(win->RPort, 1);
- SetDrMd(win->RPort, JAM1);
- Move(win->RPort, 100, 100);
- TT_SetAttrs(win->RPort, TT_Window, win, TAG_END);
- TT_Text(win->RPort, "some text", 9);
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), TT_SetAttrsA()
-
- ttengine.library/TT_TextExtent ttengine.library/TT_TextExtent
-
- NAME
- TT_TextExtent -- Determine raster extent of text data. (V4)
-
- SYNOPSIS
- TT_TextExtent (rastport, text, count, extent)
- A1 A0 D0:16 A2
-
- VOID TT_TextExtent (struct RastPort*, APTR, WORD,
- struct TextExtent*);
-
- FUNCTION
- Computes dimensions and coordinates of smallest rectangle containing
- on the whole given text rendered with current settings. TextExtent
- structure fields have following meaning:
-
- te_Width - Horizontal advance of RastPort pen position. The same as
- TT_TextLength() call result.
- te_Height - Just current font height.
- te_Extent.MinX - The horizontal distance from text start point to the
- leftmost pixel rendered. May be negative, it means that some
- pixels will be plotted before the start point.
- te_Extent.MaxX - The horizontal distance from text start point to the
- rightmost pixel rendered.
- te_Extent.MinY - The vertical distance from text start point to the
- topmost pixel rendered. Always negative, do not neccesarily equal
- to -TTFA_Ascender.
- te_Extent.MaxY - The vertical distance from text start point to the
- lowermost pixel rendered. Typically positive if anything is to be
- drawn below the baseline.
-
- INPUTS
- rastport - this rastport settings (font, size, style etc.) will be
- used for calculations.
- text - a string (not neccesarily NULL-terminated) to compute the
- rectangle for.
- count - length of the string in characters.
- extent - pointer to TextExtent structure - it will be filled with
- data.
-
- RESULT
- No retrurn value. TextExtent structure is filled with data.
-
- NOTES
- This function is almost identical to graphics.library/TextExtent().
- It even receives parameters in the same registers.
-
- Do not assume neither horizontal extents sum up to te_Width, nor
- vertical ones sum up to font height.
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), graphics.library/TextExtent()
-
- ttengine.library/TT_TextFit ttengine.library/TT_TextFit
-
- NAME
- TT_TextFit -- Count characters that will fit in a given extent. (V4)
-
- SYNOPSIS
- characters = TT_TextFit (rastport, string, count, extent,
- A1 A0 D0:16 A2
- constr_extent, direction, width, height)
- A3 D1 D2 D3
-
- ULONG TT_TextFit (struct RastPort*, APTR, UWORD, struct TextExtent*,
- struct TextExtent*, WORD, UWORD, UWORD);
-
- FUNCTION
- Computes how many characters of given NULL-terminated string rendered
- with current settings will fit into given extent. Also calculates an
- extent for this fitting part of the string. Function can fit from the
- beginning of the string to the right, or from the end of the string
- to the left. If 'constr_extent' is non NULL, string is fitted only
- against it, constraining 'width' and 'height' are ignored.
-
- INPUTS
- rastport - calculations will be performed using this rastport
- settings (font, size, styles etc.).
- string - A string (not neccesarily NULL-terminated) to fit.
- count - string lenght in characters.
- extent - Pointer to TextExtent structure - it will be filled with
- dimensions of fitted part of the string. May be filled with all
- zeros if no fit is possible at all (e.g. height is to small).
- constr_extent - Pointer to already filled TextExtent structure. Part
- of the string will fit into this extent. It is not modified by
- function. May be NULL, 'width' and 'height' will be used as
- constraints.
- direction - When equal to 1 string will be fitted starting from it's
- beginning to the rigth. When equal to -1, string will be fitted
- starting from it's end to the left.
- width - If 'constr_extent' is NULL, the string width will be compared
- with this parameter. Ignored otherwise.
- height - If 'constr_extent' is NULL, the string height will be
- compared with this parameter. Ignored otherwise.
-
- RESULT
- characters - the length of fitting string part. May be zero if no fit
- found.
-
- NOTES
- This function is almost identical to graphics.library/TextFit().
- It even receives parameters in the same registers.
-
- Do not assume neither horizontal extents sum up to te_Width, nor
- vertical ones sum up to font height (in returned extent).
-
- BUGS
-
- SEE ALSO
- TT_OpenFontA(), graphics.library/TextFit()
-
- ttengine.library/TT_TextLength ttengine.library/TT_TextLength
-
- NAME
- TT_TextLength -- Gets string length in pixels (V4).
-
- SYNOPSIS
- length = TT_TextLength(rastport, string, count)
- A1 A0 D0
-
- ULONG TT_TextLength (struct RastPort*, APTR, ULONG);
-
- FUNCTION
- Calculates the pixel width of given string written with current font.
- Takes kerning into account. String will be mapped to Unicode using
- current encoding.
-
- INPUTS
- rastport - render engine and font settings for this RastPort will be
- used for calculations.
- string - the length of this string will be calculated.
- count - the string lenght in characters.
-
- RESULT
- length - the length of the string in pixels.
-
- NOTES
-
- BUGS
-
- SEE ALSO
- TT_Text(), TT_OpenFontA()
-
-